


***Name: "Hlzern"	! Must be defined railing type name
***Code: 10001								! Must be defined identification code
                                            ! It must be also the subroutine label in GDL section

!Notes:

!B Bool       [] both option available [0] only 0 available [1] only 1 available
!I Integer    [0,15] value range 0=<p=<15, [] means unlimited value range [0] means param. not available
!D Double     [0.32,99] value range [] means unlimited value range [0] means param. not available
!M Material   [0] means param. not available
!P Pen        [0] means param. not available
!F Fill       [0] means param. not available
!T Text       [0] means param. not available
!S Font type  [0] means param. not available

***STD***         ! Must be defined standard parameters section delimiter.
                  ! Section may be empty, but parameter names and types not able to change

RailingOffset:     D [-1.0,1.0]=0.05 		! railing offset to edge of stair value: positive value means inside
RailingUpPos:      D [0.0, 10.0]=0.9	 	! railing top position above step level
RailingDnPos:      D [0.0, 0.0]=0    	! railing bottom position above step level
ColumnOffset:      D [0,0]=0		    	! column offset to railing line value: positive value means inside
ColumnOffsetUp:    D [0,0]=0       		! column horizontal overhang up
ColumnOffsetDn:    D [0,0]=0       		! column horizontal overhang down
FirstColumnOffset: D [0,3]=0.1       ! first column offset along the railing
CnPlacementType:   I [0,3]=2         ! no Column, closest to, on every Tread, pieces: 0,1,2,3
ClosestToDistance: D [0.2,3.2]=0.80  ! distance of columns to each other
SnapToCorners:     B [1,1]=0            ! 1=columns  at segment ends

***ADD***         ! Must be defined additional parameters section delimiter (section may be empty)

res:"Hohe Aufl.gen" B [0,1]=0
wr: "Breite" D [0.01, 0.15]=0.07             ! width of rail section
hr: "Hhe" D [0.01, 0.15]=0.05            ! height of rail section
r1: "Fllstabradius" D [0.01, 0.15]=0.05  ! radius of base circle of balluster
mat_r: "Gelndermat." M []=14           ! railing material
mat_c: "Fllstabmaterial" M []=14            ! column material


***GDL***         ! Must be defined section delimiter for railing GDL subroutine






!================================================ GDL OF RAILING
!================================================================



10001:                            ! railing code

ac1=r1*2                          ! side of column joker


if res =0 then resol 8 else resol 36


IF current_side=0 then





    !***************************** left side railing


    nr=segm_l[current_segment][2]    !number of railing coordinates
    n=segm_l[current_segment][6]     !number of columns


    fqw1=segm_l[current_segment][3]  !first point index of current segment
    fqwn=segm_l[current_segment][3]+segm_l[current_segment][2]-1  !last point index of current segment


    !********************* rail

    material mat_r

    !plus one point for tube direction at the beginning & in the end

    x1=rail_l [fqw1][1]-(rail_l [fqw1+1][1]-rail_l [fqw1][1])
    y1=rail_l [fqw1][2]-(rail_l [fqw1+1][2]-rail_l [fqw1][2])
    z1=rail_l [fqw1][3]-(rail_l [fqw1+1][3]-rail_l [fqw1][3])

    xn=rail_l [fqwn][1]+(rail_l [fqwn][1]-rail_l [fqwn-1][1])
    yn=rail_l [fqwn][2]+(rail_l [fqwn][2]-rail_l [fqwn-1][2])
    zn=rail_l [fqwn][3]+(rail_l [fqwn][3]-rail_l [fqwn-1][3])


    ff=wr/0.07      ! railing section resizing factors
    fff=hr/0.05

    for i=fqw1 to fqwn
        put rail_l [i][1], rail_l [i][2], rail_l [i][3], 0
    next i


    tube 20, nr+2, 1+2+16+32,
        0.0,             0.025*fff,        1,
        0.006*ff,        0.024786*fff,     1,
        0.011968*ff,     0.024143*fff,     1,
        0.017876*ff,     0.023076*fff,     1,
        0.023693*ff,     0.02159*fff,      1,
        0.028292*ff,     0.018933*fff,     1,
        0.031904*ff,     0.015038*fff,     1,
        0.034209*ff,     0.010252*fff,     1,
        0.035*ff,        0.005*fff,        1,
        0.035*ff,       -0.025*fff,        1,
       -0.035*ff,       -0.025*fff,        1,
       -0.035*ff,        0.005*fff,        1,
       -0.034209*ff,     0.010252*fff,     1,
       -0.031904*ff,     0.015038*fff,     1,
       -0.028292*ff,     0.018933*fff,     1,
       -0.023693*ff,     0.02159*fff,      1,
       -0.017876*ff,     0.023076*fff,     1,
       -0.011968*ff,     0.024143*fff,     1,
       -0.006*ff,        0.024786*fff,     1,
        0.0,             0.025*fff,        1,

        x1, y1, z1, 0,
        get (nsp),
        xn, yn, zn, 0


    !*********************** columns

    material mat_c


    for i=segm_l[current_segment][7] to segm_l[current_segment][7]+n-1

        c1=column_l[i][4]                       ! column point index

        hc1=rail_l[c1][3]-column_l[i][3]   ! height of column

        addx column_l[i][1]
        addy column_l[i][2]
        addz column_l[i][3]

        roty -90

        muly r1/0.05
        mulz r1/0.05

        revolve 62, 360, 1+2+4+8+16+32,
            0.0,          0.0,        1,
            0.0,          0.05,       1,
            0.075,        0.05,       1,
            0.077187,     0.05,       1,
            0.081495,     0.04924,    1,
            0.085606,     0.047744,   1,
            0.089394,     0.045557,   1,
            0.092745,     0.042745,   1,
            0.095557,     0.039394,   1,
            0.097744,     0.035606,   1,

            0.09924,      0.031495,     1,
            0.1,          0.027187,     1,
            0.1,          0.025,        1,
            0.1005,       0.025,        1,
            0.15,         0.025,        1,
            0.4,          0.065,        1,
            0.404344,     0.065595,     1,
            0.411143,     0.065316,     1,
            0.41779,      0.063859,     1,
            0.424083,     0.061271,     1,

            0.429831,     0.057629,     1,
            0.43486,      0.053044,     1,
            0.439016,     0.047656,     1,
            0.442173,     0.041628,     1,
            0.444235,     0.035144,     1,
            0.44514,      0.028399,     1,
            0.445,        0.025,        1,
            0.46,         0.025,        1,
            0.46,         0.0285,       1,
            0.461215,     0.035392,     1,

            0.463609,     0.041969,     1,
            0.467109,     0.048031,     1,
            0.471608,     0.053392,     1,
            0.476969,     0.057891,     1,
            0.483031,     0.061391,     1,
            0.489608,     0.063785,     1,
            0.4965,       0.065,        1,
            0.5035,       0.065,        1,
            0.510392,     0.063785,     1,
            0.516969,     0.061391,     1,

            0.523031,     0.057891,     1,
            0.528392,     0.053392,     1,
            0.532891,     0.048031,     1,
            0.536391,     0.041969,     1,
            0.538785,     0.035392,     1,
            0.54,         0.0285,       1,
            0.54,         0.025,        1,
            0.555,        0.025,        1,
            0.554918,     0.029384,     1,
            0.555993,     0.036103,     1,

            0.558219,     0.042534,     1,
            0.561527,     0.04848,      1,
            0.565818,     0.053761,     1,
            0.57096,      0.058218,     1,
            0.576798,     0.061713,     1,
            0.583155,     0.064142,     1,
            0.589837,     0.065429,     1,
            0.59664,      0.065538,     1,
            0.6,          0.065,        1,
            0.85,         0.025,        1,

            hc1,          0.025,        1,
            hc1,          0.0,          1

        del 4+2

    next i



ELSE





    !***************************** right side railing


    nr=segm_r[current_segment][2]    !number of railing coordinates
    n=segm_r[current_segment][6]     !number of columns


    fqw1=segm_r[current_segment][3]  !first point index of current segment
    fqwn=segm_r[current_segment][3]+segm_r[current_segment][2]-1  !last point index of current segment


    !********************* rail

    material mat_r

    !plus one point for tube direction at the beginning & in the end

    x1=rail_r [fqw1][1]-(rail_r [fqw1+1][1]-rail_r [fqw1][1])
    y1=rail_r [fqw1][2]-(rail_r [fqw1+1][2]-rail_r [fqw1][2])
    z1=rail_r [fqw1][3]-(rail_r [fqw1+1][3]-rail_r [fqw1][3])

    xn=rail_r [fqwn][1]+(rail_r [fqwn][1]-rail_r [fqwn-1][1])
    yn=rail_r [fqwn][2]+(rail_r [fqwn][2]-rail_r [fqwn-1][2])
    zn=rail_r [fqwn][3]+(rail_r [fqwn][3]-rail_r [fqwn-1][3])


    ff=wr/0.07      ! railing section resizing factors
    fff=hr/0.05

    for i=fqw1 to fqwn
        put rail_r [i][1], rail_r [i][2], rail_r [i][3], 0
    next i


    tube 20, nr+2, 1+2+16+32,
        0.0,             0.025*fff,        1,
        0.006*ff,        0.024786*fff,     1,
        0.011968*ff,     0.024143*fff,     1,
        0.017876*ff,     0.023076*fff,     1,
        0.023693*ff,     0.02159*fff,      1,
        0.028292*ff,     0.018933*fff,     1,
        0.031904*ff,     0.015038*fff,     1,
        0.034209*ff,     0.010252*fff,     1,
        0.035*ff,        0.005*fff,        1,
        0.035*ff,       -0.025*fff,        1,
       -0.035*ff,       -0.025*fff,        1,
       -0.035*ff,        0.005*fff,        1,
       -0.034209*ff,     0.010252*fff,     1,
       -0.031904*ff,     0.015038*fff,     1,
       -0.028292*ff,     0.018933*fff,     1,
       -0.023693*ff,     0.02159*fff,      1,
       -0.017876*ff,     0.023076*fff,     1,
       -0.011968*ff,     0.024143*fff,     1,
       -0.006*ff,        0.024786*fff,     1,
        0.0,             0.025*fff,        1,

        x1, y1, z1, 0,
        get (nsp),
        xn, yn, zn, 0


    !*********************** columns

    material mat_c


    for i=segm_r[current_segment][7] to segm_r[current_segment][7]+segm_r[current_segment][6]-1

        c1=column_r[i][4]                       ! column point index

        hc1=rail_r[c1][3]-column_r[i][3]   ! height of column

        addx column_r[i][1]
        addy column_r[i][2]
        addz column_r[i][3]

        roty -90

        muly r1/0.05
        mulz r1/0.05

        revolve 62, 360, 1+2+4+8+16+32,
            0.0,          0.0,        1,
            0.0,          0.05,       1,
            0.075,        0.05,       1,
            0.077187,     0.05,       1,
            0.081495,     0.04924,    1,
            0.085606,     0.047744,   1,
            0.089394,     0.045557,   1,
            0.092745,     0.042745,   1,
            0.095557,     0.039394,   1,
            0.097744,     0.035606,   1,

            0.09924,      0.031495,     1,
            0.1,          0.027187,     1,
            0.1,          0.025,        1,
            0.1005,       0.025,        1,
            0.15,         0.025,        1,
            0.4,          0.065,        1,
            0.404344,     0.065595,     1,
            0.411143,     0.065316,     1,
            0.41779,      0.063859,     1,
            0.424083,     0.061271,     1,

            0.429831,     0.057629,     1,
            0.43486,      0.053044,     1,
            0.439016,     0.047656,     1,
            0.442173,     0.041628,     1,
            0.444235,     0.035144,     1,
            0.44514,      0.028399,     1,
            0.445,        0.025,        1,
            0.46,         0.025,        1,
            0.46,         0.0285,       1,
            0.461215,     0.035392,     1,

            0.463609,     0.041969,     1,
            0.467109,     0.048031,     1,
            0.471608,     0.053392,     1,
            0.476969,     0.057891,     1,
            0.483031,     0.061391,     1,
            0.489608,     0.063785,     1,
            0.4965,       0.065,        1,
            0.5035,       0.065,        1,
            0.510392,     0.063785,     1,
            0.516969,     0.061391,     1,

            0.523031,     0.057891,     1,
            0.528392,     0.053392,     1,
            0.532891,     0.048031,     1,
            0.536391,     0.041969,     1,
            0.538785,     0.035392,     1,
            0.54,         0.0285,       1,
            0.54,         0.025,        1,
            0.555,        0.025,        1,
            0.554918,     0.029384,     1,
            0.555993,     0.036103,     1,

            0.558219,     0.042534,     1,
            0.561527,     0.04848,      1,
            0.565818,     0.053761,     1,
            0.57096,      0.058218,     1,
            0.576798,     0.061713,     1,
            0.583155,     0.064142,     1,
            0.589837,     0.065429,     1,
            0.59664,      0.065538,     1,
            0.6,          0.065,        1,
            0.85,         0.025,        1,

            hc1,          0.025,        1,
            hc1,          0.0,          1

        del 4+2

    next i


ENDIF


1000144:

del top

RETURN
